<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ page import="issr.market.model.Utente" %>
 
 <% Utente user = (Utente)request.getSession().getAttribute("userLogged");
 	
 	String actionToDo = "crea";
	String title = "Creazione";
	String nomeUtente = "";
	String login = "";
	String email = "";
	String telefono = "";
	String ruolo = "";
	
	if(request.getParameter("action")!=null && request.getParameter("action").equals("modifica")){
		actionToDo = "modifica";
		title = "Modifica";
		nomeUtente = request.getParameter("nomeUtente");
		login = request.getParameter("login");
		email = request.getParameter("email");
		telefono = request.getParameter("telefono");
		ruolo = request.getParameter("ruolo");
	}

 %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" href="../css/style.ie6.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="../css/style.ie7.css" type="text/css" media="screen" /><![endif]-->
	
	<script type="text/javascript" src="../js/jquery-1.7.2.js"></script>
    

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><%=title%> Utente</title>
</head>

<script>
 	$(document).ready(function() {
 		$("#role-<%=ruolo%>").attr("selected", "selected");	
 	});
 </script>
 
<body onUnload="javascript:window.opener.location.reload (); window.close();">
<div id="art-page-background-glare">
        <div id="art-page-background-glare-image"></div>
    </div>
	<div id="art-main">
		<form name="gestioneUtenteForm" action="gestoreCredenziali" method="post">
			<fieldset>
				<legend><%=title%> Nuovo Utente</legend>
				<input type="hidden" name="actionToDo" id="actionToDo" value="<%=actionToDo%>" />
				<input type="hidden" name="idModifica" id="idUtente" value="<%=request.getParameter("idModifica") %>" />
				<div>
					<label>Nome Completo</label>
					<input type="text" name="nomeUtente" id="nomeUtente" value="<%=nomeUtente%>"/>
				</div>
				<div>
					<label>Login</label>
					<input type="text" name="loginUtente" id="loginUtente" value="<%=login%>"/>
				</div>
				<div>
					<label>Password</label>
					<input type="password" name="password" id="password" />
				</div>
				<div>
					<label>Conferma Password</label>
					<input type="password" name="confermaPassword" id="confermaPassword" />
				</div>
				<div>
					<label>Scad. Password</label>
					<input type="text" size="2" style="width:30px !important;" name="scadenzaPwd" id="scadenzaPwd" />
					<div style="width:30%;margin:auto;color:#888888;font-size:0.9em">
						(mesi, max 12)
					</div>
				</div>
				<div>
					<label>E-mail</label>
					<input type="text" name="mailUtente" id="mailUtente" value="<%=email%>"/>
				</div>
				<div>
					<label>Conferma E-mail</label>
					<input type="text" name="confermaMail" id="confermaMail" value="<%=email %>" />
				</div>
				<div>
					<label>Telefono</label>
					<input type="text" name="telUtente" id="telUtente" value="<%=telefono %>"/>
				</div>
				<div>
					<label>Scad. Registrazione</label>
					<input type="text" size="2" style="width:30px !important;" name="scadenzaReg" id="scadenzaReg" />
					<div style="width:30%;margin:auto;color:#888888;font-size:0.9em">
						(mesi)
					</div>
				</div>
				<div>
					<label>Ruolo</label>
					<select name="ruoloUtente" id="ruoloUtente" >
					<% if(user.getNumRuolo()==0)%>
					  <option value="1" id="role-1"> Admin Locale </option>
	                  <option value="2" id="role-2"> Addetto Reclami </option>
	                  <option value="3" id="role-3"> Analista Indici </option>
	                <% if(user.getNumRuolo()==0 || user.getNumRuolo()==1) %>
	               	  <option value="4" id="role-4"> Gestore Credenziali </option> 
	                  <option value="5" id="role-5"> Magazziniere </option>
	                  <option value="6" id="role-6"> Operatore Banco </option>
					</select>	
				</div>
				</fieldset>
			<div><input type="submit" name="submit" value="Registra" /></div>
		</form>
	</div>
</body>
</html>